home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 13 / AMIGAplus Sonderheft 13 (1998)(ICP)(DE)[!].iso / rexx / flushdatatypes.sirexx < prev    next >
Text File  |  1997-08-28  |  1KB  |  69 lines

  1. /* This will expunge all unused datatypes from memory */
  2.  
  3. options results
  4. signal on error
  5.  
  6. address 'INSPECTOR.1'
  7.  
  8.  
  9.  
  10. /* Select the Libs list. */
  11.  
  12. GetDisplay ; currentdisplay = result
  13. If currentdisplay ~= 5 Then SetDisplay 5
  14.  
  15.  
  16. /* We don't want to be bothered with requesters */
  17.  
  18. GetPrefs Confirm ; oldconfirm = result
  19. if oldconfirm = "ON" Then SetPrefs Confirm OFF
  20.  
  21.  
  22. /* browse thru the list until we reach the last item. */
  23.  
  24. flushed = 0
  25.  
  26. counter = 0
  27.  
  28. done = 0
  29.  
  30. Do while done = 0
  31.  
  32.    SelectNode Num counter ; if result = "ERROR" then done = 1
  33.  
  34.    If done = 0 Then Do
  35.       GetNodeInfo 1 ; nodename = result
  36.  
  37. /* Should this node be flushed? */
  38.  
  39.       If Pos(".datatype",nodename) >0 Then Do 
  40.  
  41.          SetStatus "Flushing..."
  42.          FlushNode
  43.  
  44. /* If the node is gone, then the next node was moved one level to the 
  45.    top - so our next node is on that same position.  So, we won't
  46.    move down, so next iteration will be on this bubbled-up node. */
  47.  
  48.          GetStatus ; status = result
  49.          If Pos("Flushed",status) > 0 Then Do
  50.             counter = counter - 1  /* So we do not skip the new one */
  51.             flushed = flushed + 1
  52.          End
  53.       End
  54.  
  55.       counter = counter + 1
  56.  
  57.    End
  58. End
  59.  
  60.  
  61.  
  62. /* Restore the Confirm setting */
  63.  
  64. SetPrefs Confirm oldconfirm
  65.  
  66. /* Report */
  67.  
  68. SetStatus 'Flushed '||flushed||' datatype(s).'
  69.